﻿using Little.Soldier.SWIFT;
using Little.Soldier.SWIFT.Definition;
using System.Collections.Generic;
using System.ComponentModel;

namespace Little.Soldier.SWIFT.Messages.Category8
{
  public class MT824 : SwiftMessage
  {
    private static SwiftMessageDefinition MessageDefinition;
    private static SwiftTagDefinition U0002;
    private static SwiftTagSubItemDefinition U0003;
    private static SwiftTagDefinition U0004;
    private static SwiftTagSubItemDefinition U0005;
    private static SwiftTagChoiceDefinition U0006;
    private static SwiftTagDefinition U0007;
    private static SwiftTagSubItemDefinition U0008;
    private static SwiftTagSubItemDefinition U000E;
    private static SwiftTagDefinition U000F;
    private static SwiftTagSubItemDefinition U0010;
    private static SwiftTagSequenceDefinition U0011;
    private static SwiftTagSequenceDefinition U0012;
    private static SwiftTagDefinition U0013;
    private static SwiftTagSubItemDefinition U0014;
    private static SwiftTagSubItemDefinition U0015;
    private static SwiftTagSubItemDefinition U0016;
    private static SwiftTagSubItemDefinition U0017;
    private static SwiftTagSubItemDefinition U0018;
    private static SwiftTagSubItemDefinition U0019;
    private static SwiftTagDefinition U001A;
    private static SwiftTagSubItemDefinition U001B;
    private static SwiftTagSubItemDefinition U001C;
    private static SwiftTagSubItemDefinition U001D;
    private static SwiftTagDefinition U001E;
    private static SwiftTagSubItemDefinition U001F;
    private static SwiftTagDefinition U007F;
    private static SwiftTagDefinition U0080;

    [Description("Transaction Reference Number")]
    public Tag20 TransactionReferenceNumber_20
    {
      get
      {
        return new Tag20((SwiftElement) this, 0, (SwiftDefinitionElement) MT824.U0002);
      }
    }

    [Description("Transaction Reference Number")]
    public Tag20 Tag20_TransactionReferenceNumber
    {
      get
      {
        return this.TransactionReferenceNumber_20;
      }
    }

    [Description("Date Destroyed/ Cancelled")]
    public Tag30 DateDestroyedCancelled_30
    {
      get
      {
        return new Tag30((SwiftElement) this, 0, (SwiftDefinitionElement) MT824.U0004);
      }
    }

    [Description("Date Destroyed/ Cancelled")]
    public Tag30 Tag30_DateDestroyedCancelled
    {
      get
      {
        return this.DateDestroyedCancelled_30;
      }
    }

    [Description("Selling Agent")]
    public Tag51A SellingAgent_51A
    {
      get
      {
        return new Tag51A((SwiftElement) this, 0, (SwiftDefinitionElement) MT824.U0007);
      }
    }

    [Description("Selling Agent")]
    public Tag51A Tag51A_SellingAgent
    {
      get
      {
        return this.SellingAgent_51A;
      }
    }

    [Description("Selling Agent")]
    public Tag51C SellingAgent_51C
    {
      get
      {
        return new Tag51C((SwiftElement) this, 0, (SwiftDefinitionElement) MT824.U000F);
      }
    }

    [Description("Selling Agent")]
    public Tag51C Tag51C_SellingAgent
    {
      get
      {
        return this.SellingAgent_51C;
      }
    }

    [Description("Cheque Details and Currency Value")]
    public MT824.ChequeDetailsAndCurrencyValue_SequenceClass[] ChequeDetailsAndCurrencyValue_Sequence
    {
      get
      {
        int index = -1;
        List<MT824.ChequeDetailsAndCurrencyValue_SequenceClass> list = new List<MT824.ChequeDetailsAndCurrencyValue_SequenceClass>();
        int count;
        do
        {
          ++index;
          MT824.ChequeDetailsAndCurrencyValue_SequenceClass valueSequenceClass = new MT824.ChequeDetailsAndCurrencyValue_SequenceClass((SwiftElement) this, index, false);
          count = this.ListTags((SwiftElement) valueSequenceClass).Count;
          if (count > 0)
            list.Add(valueSequenceClass);
        }
        while (count > 0);
        return list.ToArray();
      }
    }

    [Description("Reason For Destruction/Cancellation")]
    public Tag77B ReasonForDestructionCancellation_77B
    {
      get
      {
        return new Tag77B((SwiftElement) this, 0, (SwiftDefinitionElement) MT824.U007F);
      }
    }

    [Description("Reason For Destruction/Cancellation")]
    public Tag77B Tag77B_ReasonForDestructionCancellation
    {
      get
      {
        return this.ReasonForDestructionCancellation_77B;
      }
    }

    [Description("Sender To Receiver Information")]
    public Tag72 SenderToReceiverInformation_72
    {
      get
      {
        return new Tag72((SwiftElement) this, 0, (SwiftDefinitionElement) MT824.U0080);
      }
    }

    [Description("Sender To Receiver Information")]
    public Tag72 Tag72_SenderToReceiverInformation
    {
      get
      {
        return this.SenderToReceiverInformation_72;
      }
    }

    public MT824()
      : base(true)
    {
    }

    public MT824(SwiftMessage message)
      : base(message)
    {
    }

    public MT824.ChequeDetailsAndCurrencyValue_SequenceClass AddChequeDetailsAndCurrencyValue_Sequence()
    {
      return new MT824.ChequeDetailsAndCurrencyValue_SequenceClass((SwiftElement) this, this.ChequeDetailsAndCurrencyValue_Sequence.Length, true);
    }

    public void RemoveChequeDetailsAndCurrencyValue_Sequence(MT824.ChequeDetailsAndCurrencyValue_SequenceClass sequence)
    {
      foreach (SwiftTag tag in this.ListTags((SwiftElement) sequence))
        this.RemoveTag(tag);
    }

    internal override SwiftMessageDefinition MsgDefinition()
    {
      return MT824.MessageDefinition;
    }

    protected override void InitSwiftMessageDefinition()
    {
      MT824.MessageDefinition = new SwiftMessageDefinition("MT824", "T/C Inventory Destruction/Cancellation Notice");
      MT824.U0002 = new SwiftTagDefinition("TransactionReferenceNumber_20", "Transaction Reference Number");
      MT824.U0002.TagName = ":20:";
      MT824.U0003 = new SwiftTagSubItemDefinition("Reference", "Transaction Reference Number");
      MT824.U0002.Elements.Add((SwiftDefinitionElement) MT824.U0003);
      MT824.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT824.U0002);
      MT824.U0004 = new SwiftTagDefinition("DateDestroyedCancelled_30", "Date Destroyed/ Cancelled");
      MT824.U0004.TagName = ":30:";
      MT824.U0004.Mandatory = false;
      MT824.U0005 = new SwiftTagSubItemDefinition("Date", "Date");
      MT824.U0004.Elements.Add((SwiftDefinitionElement) MT824.U0005);
      MT824.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT824.U0004);
      MT824.U0006 = new SwiftTagChoiceDefinition("Choice", "");
      MT824.U0006.Multiple = true;
      MT824.U0007 = new SwiftTagDefinition("SellingAgent_51A", "Selling Agent");
      MT824.U0007.TagName = ":51A:";
      MT824.U0008 = new SwiftTagSubItemDefinition("PartyIdentifier", "Party Identifier");
      MT824.U0008.Mandatory = false;
      MT824.U0007.Elements.Add((SwiftDefinitionElement) MT824.U0008);
      MT824.U000E = new SwiftTagSubItemDefinition("BankIdentifierCode", "Bank dentifier Code");
      MT824.U0007.Elements.Add((SwiftDefinitionElement) MT824.U000E);
      MT824.U0006.Elements.Add((SwiftDefinitionElement) MT824.U0007);
      MT824.U000F = new SwiftTagDefinition("SellingAgent_51C", "Selling Agent");
      MT824.U000F.TagName = ":51C:/";
      MT824.U0010 = new SwiftTagSubItemDefinition("Account", "Account");
      MT824.U000F.Elements.Add((SwiftDefinitionElement) MT824.U0010);
      MT824.U0006.Elements.Add((SwiftDefinitionElement) MT824.U000F);
      MT824.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT824.U0006);
      MT824.U0011 = new SwiftTagSequenceDefinition("ChequeDetailsAndCurrencyValue_Sequence", "Cheque Details and Currency Value");
      MT824.U0011.Multiple = true;
      MT824.U0012 = new SwiftTagSequenceDefinition("ChequeDetails_Sequence", "");
      MT824.U0012.Multiple = true;
      MT824.U0013 = new SwiftTagDefinition("DetailsOfCheques_68A", "Details Of Cheques");
      MT824.U0013.TagName = ":68A:";
      MT824.U0014 = new SwiftTagSubItemDefinition("NumberCurrencyAndDenomination", "Number Currency And Denomination");
      MT824.U0013.Elements.Add((SwiftDefinitionElement) MT824.U0014);
      MT824.U0015 = new SwiftTagSubItemDefinition("Mode", "Mode");
      MT824.U0013.Elements.Add((SwiftDefinitionElement) MT824.U0015);
      MT824.U0016 = new SwiftTagSubItemDefinition("Amount", "Amount");
      MT824.U0016.Mandatory = false;
      MT824.U0017 = new SwiftTagSubItemDefinition("Amount_1", "Amount");
      MT824.U0016.Elements.Add((SwiftDefinitionElement) MT824.U0017);
      MT824.U0013.Elements.Add((SwiftDefinitionElement) MT824.U0016);
      MT824.U0018 = new SwiftTagSubItemDefinition("ProductCode", "Product Code");
      MT824.U0018.Mandatory = false;
      MT824.U0019 = new SwiftTagSubItemDefinition("ProductCode_1", "Product Code");
      MT824.U0018.Elements.Add((SwiftDefinitionElement) MT824.U0019);
      MT824.U0013.Elements.Add((SwiftDefinitionElement) MT824.U0018);
      MT824.U0012.Elements.Add((SwiftDefinitionElement) MT824.U0013);
      MT824.U001A = new SwiftTagDefinition("SerialNumbers_26B", "Serial Numbers");
      MT824.U001A.TagName = ":26B:";
      MT824.U001A.Multiple = true;
      MT824.U001B = new SwiftTagSubItemDefinition("Number1", "Number1");
      MT824.U001A.Elements.Add((SwiftDefinitionElement) MT824.U001B);
      MT824.U001C = new SwiftTagSubItemDefinition("Number2", "Number2");
      MT824.U001C.Mandatory = false;
      MT824.U001D = new SwiftTagSubItemDefinition("Number2_1", "Number2");
      MT824.U001C.Elements.Add((SwiftDefinitionElement) MT824.U001D);
      MT824.U001A.Elements.Add((SwiftDefinitionElement) MT824.U001C);
      MT824.U0012.Elements.Add((SwiftDefinitionElement) MT824.U001A);
      MT824.U0011.Elements.Add((SwiftDefinitionElement) MT824.U0012);
      MT824.U001E = new SwiftTagDefinition("TotalFaceValueOfCurrency_19", "Total Face Value Of Currency");
      MT824.U001E.TagName = ":19:";
      MT824.U001F = new SwiftTagSubItemDefinition("Amount", "Amount");
      MT824.U001E.Elements.Add((SwiftDefinitionElement) MT824.U001F);
      MT824.U0011.Elements.Add((SwiftDefinitionElement) MT824.U001E);
      MT824.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT824.U0011);
      MT824.U007F = new SwiftTagDefinition("ReasonForDestructionCancellation_77B", "Reason For Destruction/Cancellation");
      MT824.U007F.TagName = ":77B:";
      MT824.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT824.U007F);
      MT824.U0080 = new SwiftTagDefinition("SenderToReceiverInformation_72", "Sender To Receiver Information");
      MT824.U0080.TagName = ":72:";
      MT824.U0080.Mandatory = false;
      MT824.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT824.U0080);
    }

    public class ChequeDetailsAndCurrencyValue_SequenceClass : SwiftTagSequence
    {
      internal override SwiftDefinitionElement Definition
      {
        get
        {
          return (SwiftDefinitionElement) MT824.U0011;
        }
      }

      [Description("")]
      public MT824.ChequeDetailsAndCurrencyValue_SequenceClass.ChequeDetails_SequenceClass[] ChequeDetails_Sequence
      {
        get
        {
          int index = -1;
          List<MT824.ChequeDetailsAndCurrencyValue_SequenceClass.ChequeDetails_SequenceClass> list = new List<MT824.ChequeDetailsAndCurrencyValue_SequenceClass.ChequeDetails_SequenceClass>();
          int count;
          do
          {
            ++index;
            MT824.ChequeDetailsAndCurrencyValue_SequenceClass.ChequeDetails_SequenceClass detailsSequenceClass = new MT824.ChequeDetailsAndCurrencyValue_SequenceClass.ChequeDetails_SequenceClass((SwiftElement) this, index, false);
            count = this.ListTags((SwiftElement) detailsSequenceClass).Count;
            if (count > 0)
              list.Add(detailsSequenceClass);
          }
          while (count > 0);
          return list.ToArray();
        }
      }

      [Description("Total Face Value Of Currency")]
      public Tag19 TotalFaceValueOfCurrency_19
      {
        get
        {
          return new Tag19((SwiftElement) this, 0, (SwiftDefinitionElement) MT824.U001E);
        }
      }

      [Description("Total Face Value Of Currency")]
      public Tag19 Tag19_TotalFaceValueOfCurrency
      {
        get
        {
          return this.TotalFaceValueOfCurrency_19;
        }
      }

      internal ChequeDetailsAndCurrencyValue_SequenceClass(SwiftElement parent, int index, bool createTags)
        : base(parent, index, createTags)
      {
      }

      public MT824.ChequeDetailsAndCurrencyValue_SequenceClass.ChequeDetails_SequenceClass AddChequeDetails_Sequence()
      {
        return new MT824.ChequeDetailsAndCurrencyValue_SequenceClass.ChequeDetails_SequenceClass((SwiftElement) this, this.ChequeDetails_Sequence.Length, true);
      }

      public void RemoveChequeDetails_Sequence(MT824.ChequeDetailsAndCurrencyValue_SequenceClass.ChequeDetails_SequenceClass sequence)
      {
        foreach (SwiftTag tag in this.ListTags((SwiftElement) sequence))
          this.RemoveTag(tag);
      }

      public class ChequeDetails_SequenceClass : SwiftTagSequence
      {
        internal override SwiftDefinitionElement Definition
        {
          get
          {
            return (SwiftDefinitionElement) MT824.U0012;
          }
        }

        [Description("Details Of Cheques")]
        public Tag68A DetailsOfCheques_68A
        {
          get
          {
            return new Tag68A((SwiftElement) this, 0, (SwiftDefinitionElement) MT824.U0013);
          }
        }

        [Description("Details Of Cheques")]
        public Tag68A Tag68A_DetailsOfCheques
        {
          get
          {
            return this.DetailsOfCheques_68A;
          }
        }

        [Description("Serial Numbers")]
        public Tag26B[] SerialNumbers_26B
        {
          get
          {
            int index = -1;
            List<Tag26B> list = new List<Tag26B>();
            int count;
            do
            {
              ++index;
              Tag26B tag26B = new Tag26B((SwiftElement) this, index, (SwiftDefinitionElement) MT824.U001A);
              count = this.ListTags((SwiftElement) tag26B).Count;
              if (count > 0)
                list.Add(tag26B);
            }
            while (count > 0);
            return list.ToArray();
          }
        }

        [Description("Serial Numbers")]
        public Tag26B[] Tag26B_SerialNumbers
        {
          get
          {
            return this.SerialNumbers_26B;
          }
        }

        internal ChequeDetails_SequenceClass(SwiftElement parent, int index, bool createTags)
          : base(parent, index, createTags)
        {
        }

        public Tag26B AddSerialNumbers_26B()
        {
          return new Tag26B((SwiftElement) this, this.SerialNumbers_26B.Length, (SwiftDefinitionElement) MT824.U001A)
          {
            Value = string.Empty
          };
        }

        public void RemoveSerialNumbers_26B(Tag26B tag)
        {
          this.RemoveTag(tag.GetTag());
        }
      }
    }
  }
}
